export default {
  state: {
    props: {},
    config: {
      api:
        process.env.NODE_ENV === "development"
          ? `http://localhost:3000/api`
          : `https://cxybm.cn`
    },
    routeData: {},
    userInfo: {
      id: 20,
      username: "赤道少年",
      name: "赤道少年",
      image:
        "https://thirdwx.qlogo.cn/mmopen/vi_32/oiaOyMkj2UPWUpsIZCAyghyDFIo5R3bicHh8QrsqdFGibtC1vLCsksHD2BSxxUib3HLvRSnuxCdnvSBiaMMpg6K424Q/132",
      email: null,
      lat: 31.2391,
      lng: 121.522,
      type: "admin",
      Roles: [
        {
          id: 2,
          name: "普通用户",
          info: "普通用户",
          user_id: 3,
          created_at: "2020-10-25T13:15:47.000Z",
          updated_at: "2020-10-25T13:15:47.000Z",
          user_role: { id: 9, UserId: 16, RoleId: 2 }
        }
      ],
      token:
        "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTYsInVzZXJuYW1lIjoi5YiY5LmJIiwiZXhwIjoxNjM2NzMyODIwLCJpYXQiOjE2MzE1NDg4MjB9.IpkXjZk4lhNL3BiuBEMf8-weS9UFcxaV2esEn9nb504"
    },
    addRoutes: [],
    userRegionCode: ""
  },
  mutations: {
    props(state, data) {
      state.props = data;
      if (data.config) {
        state.config = data.config;
      }
    },
    userInfo(state, data) {
      state.userInfo = data;
    },
    userRegionCode(state, data) {
      state.userRegionCode = data;
    },
    routeData(state, data) {
      state.routeData = data;
    },
    addRoutes(state, data) {
      state.addRoutes = data;
    },
    ["YZT_OPENED_TOPICS"](state, data) {
      state.openedTopics = data;
      state.openedTopicGuids = data.map(item => {
        return item.guid;
      });
    }
  },
  getters: {
    props: state => state.props,
    config: state => state.config,
    userInfo: state => state.userInfo,
    routeData: state => state.routeData,
    addRoutes: state => state.addRoutes,
    userRegionCode: state => state.userRegionCode
  },
  actions: {},
  modules: {}
};
